package top.yaofengqiao.springcloudsimple.common.util;

import lombok.Data;
import lombok.EqualsAndHashCode;
import top.yaofengqiao.springcloudsimple.common.constant.ResponseCode;

@EqualsAndHashCode(callSuper = true)
@Data
public class AppException extends RuntimeException {

    private static final long serialVersionUID = 5317680961212299217L;

    /**
     * 异常码
     */
    private Integer code;

    /**
     * 异常信息
     */
    private String info;

    public AppException(ResponseCode responseCode) {
        super(responseCode.getCode() + "--" + responseCode.getInfo());
        this.code = responseCode.getCode();
        this.info = responseCode.getInfo();
    }
}
